home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 181 / text0000.txt < prev   
Encoding:
Text File  |  1996-08-06  |  861 b   |  29 lines

  1. Phillip Knight wrote:
  2.  
  3. >         class ologstream : public ostream {
  4. >            public:
  5.     [ ... ]
  6. >            ologstream& operator<< (foo &bar)
  7. >                    { return *this; }  // do nothing
  8. >         };
  9.  
  10. [ main() then attempts to use ologstream::operator<< on char*]
  11.  
  12. > on by ostream/ologstream operators.  The presence of an operator<<
  13. > (overloaded or otherwise) in the dervided class consequently hides the base
  14. > class operators which are public.  My question is; is this a bug in the
  15. > language [...] ?
  16.  
  17.  
  18. I believe this is the expected behavior for the language.
  19. You can call the base class version with:
  20.  
  21.   out.ostream::operator<< ("Test one.");
  22.  
  23. Or (perhaps better depending on how "natural" you want the 
  24. char * version to feel) give ologstream a member:
  25.  
  26.   ologstream& operator<< (char *str) 
  27.       { ostream::operator(str); return *this; }
  28.  
  29.